import { getStoreId } from '@/utils'
import request from '@/utils/request'
// import querystring from 'querystring'

// 获取字典key描述
export function getKey () {
  return request.get('/base/dict/getKey')
}

//获取分页数据 
export function dictPage (form, pageSize, currentPage) {
  return request.post('/base/dict/page', {
    param: form,
    pageSize: pageSize,
    pageNo: currentPage
  })
}
/**
 * 获取所有字典
 */
export function dictFindAll () {
  return request.get(`/base/dict/findAll`)
}

/**
 * 新增字典
 * @param {*} value 
 */
export function addDict (value) {
  return request.post(`/base/dict`, value)
}
/**
 * 修改
 * @param {*} value 
 */
export function updateDict (value) {
  return request.put(`/base/dict`, value)
}

/**
 * 查询字典详情
 * @param {*} value 
 */
export function getDictId (value) {
  return request.get(`/base/dict/${value}`);
}
/**
 * 删除字典
 * @param {*} value 
 */
export function deleteDict (value) {
  return request.delete(`/base/dict/${value}`);
}
/**
 * 改变字典状态
 * @param {*} value 
 */
export function changeStatus (value) {
  return request.get(`/base/dict/status/${value}`);
}

//==================单个字典值设置=================
export function dictSetValueByKey (key, value) {
  return request.put(`/base/dict/setValueByKey`, { key, value, storeId: getStoreId() })
}
/**
 * 获取相应字典
 * @param {*} dictKey 
 */
export function dictStoreSysConfigDict (dictKey) {
  return request.get(`/base/dict/storeSysConfigDict/${getStoreId()}/${dictKey}`)
}


